
package Objects;

import GameEngine.GameConstants.Modifier;
import GameEngine.Vector;


/**
 *
 * @author mhfowler
 */
public class DefaultEffects {


    /* should return a vector which is parallel to the wall, and has the magnitude of the projection
     * of the objectDirection onto a unit vector parallel to the wall. The angle of change of direction
     * should also never be acute */
    /* when you want a vector that is perpendicilar to the 2nd arg direction */
    public static Vector wallCollision(Vector objectDirection, Vector wallDirection) {
             /* sets delta p as projection onto wall */
                Vector unitDelta = objectDirection.unitNew();
                Vector projection = unitDelta.addNew(wallDirection);
                /* check if wall direciton is facing you or away from you */
                /* this should make the direction of the wall be facing towards where you were coming from */
                if (projection.getNorm() > 1.0) {
                    wallDirection.scale(-1.0);
                    projection = unitDelta.addNew(wallDirection);
                }
                /* by this point projection should be vector parallel to wall in correct direction */
                Vector toReturn = objectDirection.project(projection);
                return toReturn;
    }

}
